<?php

namespace Admin\Model;

use Think\Model\RelationModel;

class UserModel extends RelationModel
{
    protected $_link = array(
        'role' => array(    //关联到哪个表---注意大小写
            'mapping_type'      =>  self::MANY_TO_MANY,
            'foreign_key'       =>  'user_id',
            'relation_key'  =>  'role_id',
            'relation_table'    =>  'studyim_role_user', //中间表名称
            'mapping_fields'   =>   'id,name',
        ),
    );
}
